package com.github.winyiwin;

import com.github.winyiwin.queue.QueueEnum;
import com.github.winyiwin.queue.RejectedHandlerEnum;

import java.time.Duration;


public class ThreadPoolDefinition {


    private String poolName = "Lakers";

    /**
     * Core number of threads.
     */
    private int coreSize = 8;

    /**
     * Maximum allowed number of threads. If tasks are filling up the queue, the pool
     * can expand up to that size to accommodate the load. Ignored if the queue is
     * unbounded.
     */
    private int maxSize = 81;


    /**
     * Time limit for which threads may remain idle before being terminated.
     */
    private Duration keepAlive = Duration.ofSeconds(60);

    private QueueEnum queueType = QueueEnum.LinkedBlockingQueue;

    private int queueCapacity = 33643;
    private boolean fair = false;

    private RejectedHandlerEnum rejectedHandler = RejectedHandlerEnum.AbortPolicy;

    public String getPoolName() {
        return poolName;
    }

    public void setPoolName(String poolName) {
        this.poolName = poolName;
    }

    public int getCoreSize() {
        return coreSize;
    }

    public void setCoreSize(int coreSize) {
        this.coreSize = coreSize;
    }

    public int getMaxSize() {
        return maxSize;
    }

    public void setMaxSize(int maxSize) {
        this.maxSize = maxSize;
    }

    public Duration getKeepAlive() {
        return keepAlive;
    }

    public void setKeepAlive(Duration keepAlive) {
        this.keepAlive = keepAlive;
    }

    public QueueEnum getQueueType() {
        return queueType;
    }

    public void setQueueType(QueueEnum queueType) {
        this.queueType = queueType;
    }

    public int getQueueCapacity() {
        return queueCapacity;
    }

    public void setQueueCapacity(int queueCapacity) {
        this.queueCapacity = queueCapacity;
    }

    public boolean isFair() {
        return fair;
    }

    public void setFair(boolean fair) {
        this.fair = fair;
    }

    public RejectedHandlerEnum getRejectedHandler() {
        return rejectedHandler;
    }

    public void setRejectedHandler(RejectedHandlerEnum rejectedHandler) {
        this.rejectedHandler = rejectedHandler;
    }
}
